package com.inno.subject.controller.controller;

import com.inno.subject.common.entity.CommonReturnType;
import com.inno.subject.controller.convert.SubjectTypeDTOConverter;
import com.inno.subject.controller.dto.SubjectTypeDTO;
import com.inno.subject.domain.entity.SubjectTypeBO;
import com.inno.subject.domain.service.SubjectTypeDomainService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/subject/type")
@RequiredArgsConstructor
public class SubjectTypeController {
    private final SubjectTypeDomainService subjectTypeDomainService;
    /**
     * 查询题目类型列表
     */
    @GetMapping("/queryList")
    public CommonReturnType<List<SubjectTypeDTO>> queryList(){
        List<SubjectTypeBO> boList = this.subjectTypeDomainService.queryList();
        return CommonReturnType.success(SubjectTypeDTOConverter.INSTANCE.convertBOListToDTOList(boList));
    }
}
